/**
 * Created by maple on 2016/5/24.
 */

var request = require('request');




function getCharList(url, callback) {

    request(url, function (error, res, body) {
        if (!error && res.statusCode == 200) {
            //转化为JSON对象
            var info = JSON.parse(body);
          
            for (var i = 0; i < info.data.length; i++){
                if(info.data[i].c_images != undefined || info.data[i].c_images != null){
                    info.data[i].c_images = "http://www.51sfzd.com/CharCollectionSystem/upload/" + (info.data[i].c_images[info.data[i].c_images.length-1]).imgs;
                }else{
                    info.data[i].c_images = null;
                }

            }
            
            callback(info);
        }
    })
};


module.exports = getCharList;